<?php

/**
 * 字符串转为时间
 * @param string $str 时间字符串(示例2010-07-21 16:49:22)
 */
function str2time($str) {
	$array = explode("-", $str);
	$year = $array[0];
	$month = $array[1];

	$array = explode(":", $array[2]);
	$minute = $array[1];
	$second = $array[2];

	$array = explode(" ", $array[0]);
	$day = $array[0];
	$hour = $array[1];

	return mktime($hour, $minute, $second, $month, $day, $year);
}

?>